<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Stu_model extends CI_Model {


	//取全部学生
	public function getall(){
		$res = $this->db->get('student');
		return $res;
	}

	//取某个学生
	public function getone($id){
		$res = $this->db->get_where('student',array('id'=>$id));
		return $res->row();
	}

	//删除学生
	public function delete($id){
		$bool = $this->db->delete('student',array('id'=>$id));
		return $bool;
	}

	//添加学生
	public function insert($data){
		$bool = $this->db->insert('student',$data);
		return $bool;
	}

	//更新学生
	public function updata($data){
		$bool = $this->db->replace('student', $data);
		return $bool;
	}

	//查找学生
	public function search($data){
		$this->db->like($data);
		$res = $this->db->get('student');
		return $res;
	}
}